$(document).ready(function() {
	$('#EventContactId').change(function() {
		
		if($('#EventContactId option:selected').text() == "New Contact") {
			//alert ($('#EventContactId option:selected').text());
			$('#new_contact').show();
		}
		else {
			$('#new_contact').hide();
		}
	});
	
	$('a.new_full_window').click(function() {
		window.open(this.href); 
		return false;
	});
	
});

	function initialiseInputs() {
	        // Clear any old values from the inputs (that might be cached by the browser after a page reload)
	        //document.getElementById("sd").value = "<?php e(date("Y-m-d")); ?>";
	        //document.getElementById("ed").value = "";

	        // Add the onchange event handler to the start date input
	        //$("#sd").onchange = setReservationDates;
	return false;
	}
	/*function setReservationDates(e) {
	        // Check the associated datePicker object is available (be safe)
	        if(!("sd" in datePickerController.datePickers)) {
	                return;
	        }

	        // Check the value of the input is a date of the correct format
	        var dt = datePickerController.dateFormat(this.value, datePickerController.datePickers["sd"].format.charAt(0) == "m");

	        // If the input's value cannot be parsed as a valid date then return
	        if(dt == 0) return;

	        // Grab the value set within the endDate input and parse it using the dateFormat method
	        // N.B: The second parameter to the dateFormat function, if TRUE, tells the function to favour the m-d-y date format
	        var edv = datePickerController.dateFormat(document.getElementById("ed").value, datePickerController.datePickers["ed"].format.charAt(0) == "m");

	        // Grab the end date datePicker Objects
	        var ed = datePickerController.datePickers["ed"];

	        ed.setRangeLow( dt );

	        // If theres a value already present within the end date input and it's smaller than the start date
	        // then clear the end date value
	        if(edv < dt) {
	                document.getElementById("ed").value = "";
	        }
	}*/

	datePickerController.addEvent(window, 'load', initialiseInputs);